package com.bookstore.spring.service;


import com.bookstore.spring.pojo.ShoppingCart;
import org.springframework.stereotype.Service;

/**
 * Created by Admin on 2016/8/21.
 */
@Service
public class ShoppingServiceImp implements ShoppingService {

    /**
     * 删除购物车指定商品
     *
     * @param sc
     * @param id
     */
    public void delete(ShoppingCart sc, int id) {
        sc.removeItem(id);
    }

    /**
     * 清空购物车
     *
     * @param sc
     */
    public void clear(ShoppingCart sc) {
        sc.clear();
    }

    /**
     * 修改指定购物车的数量
     *
     * @param sc
     * @param id
     * @param quantity
     */
    public void updateItemQuantity(ShoppingCart sc, int id, int quantity) {
        sc.updateItemQuantity(id, quantity);
    }


}
